<template>
  <div div class="container">
    <Category title="游戏">
      <template scope="atguigu">
        {{ atguigu }}
        <!-- 接收到的内容为一个对象 { "games": [ "LOL", "王者荣耀", "DNF", "绝地求生" ], "hello": "slot" } -->
        <ol>
          <li v-for="(item, index) of atguigu.games" :key="index">
            {{ item }}
          </li>
        </ol>
      </template>
    </Category>

    <Category title="游戏">
      <template slot-scope="{ games, hello }">
        <!-- 使用 template 标签 并添加 slot-scope=""2.5+ 或 scope=""属性 
          接收组件<slot>标签中传递的数据 为对象格式,可以使用结构赋值-->
        <ul>
          <li v-for="(item, index) of games" :key="index">{{ item }}</li>
        </ul>
        <h4>{{ hello }}</h4>
      </template>
    </Category>
  </div>
</template>
<script>
import Category from "./components/Category.vue";
export default {
  name: "App",
  components: { Category },
};
</script>
<style scoped>
.container,
.foot {
  display: flex;
  justify-content: space-around;
}
h4 {
  text-align: center;
}
</style>
